#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	FILE* fp = fopen("bite.txt", "w+");
	if (fp == nullptr)
	{
		perror("fopen fail");
		return 1;
	}

	const char* str = "linux so easy!\n";
	fwrite(str, 1, strlen(str), fp);

	fseek(fp, 0, SEEK_SET);

	char buffer[1024];
	fread(buffer, 1, sizeof(buffer), fp);
	
	for (int i = 0; buffer[i]; i++)
	{
		cout << buffer[i];
	}
	cout << endl;

	fclose(fp);

	return 0;
}

